<?php include('./templete/public/head.php') ?>
<body>
<hr class="bgcolor"/>
<!--发布金点子-->
<div class="fabu-main fabu-gonglue-main">
    <div class="main-content">
        <div class="c-list">
            <ul class="comm-table-view">
                <li class="table-view-cell">
                    <a>
                        <span class="title">标题</span>
                        <span class="line">|</span>
                        <span class="input"><input type="text" id="title"/></span>
                        <span class="fr"><i class="iconfont icon-youjiantou"></i></span>
                    </a>
                </li>
                <li class="table-view-cell table-view-cell2">
                    <a>
                        <span>分享内容</span>
                        <div class="fabu-text">
                            <textarea id="content"></textarea>
                        </div>
                    </a>
                </li>
            </ul>
            <div class="comm-btn comm-btn2 fabu-btn">
                <span class="color1 publish">发布分享</span>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    function add_img() {
        document.getElementById('_img_upload').click();
    }

    $('.publish').click(function () {
        var title = $('#title').val();
        var content = $('#content').val();
        if (!title) {
            layer.msg('请输入活动标题');
            return false;
        }
        if (!content) {
            layer.msg('请输入活动内容');
            return false;
        }
        layer.msg('请稍等');
        var loading = layer.load(1, {shade: [0.4, '#000']}); //0代表加载的风格，支持0-2
        $.ajax({
            url: "<?php echo url('insert') ?>",
            type: 'post',
            data: {
                title: title,
                content: content,
            },
            success: function (res) {
                if (res.code == 0) {
                    layer.msg(res.msg);
                    setTimeout(function () {
                        location.href = res.url;
                    }, 1000);
                } else {
                    layer.msg(res.msg);
                }
                setTimeout(function () {
                    layer.closeAll();
                }, 1000);
            }
        })
    })

</script>
</html>